package com.tf_cut.backend.mapper;

import com.tf_cut.backend.platform.vo.GrantDetailVo;
import com.tf_cut.backend.platform.vo.OrderDetailVO;
import com.tf_cut.backend.platform.vo.PersonalTaxVo;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GrantDetailMapper {

	List<GrantDetailVo> queryGrantDetailList(GrantDetailVo svo);

	GrantDetailVo queryGrantDetailById(@Param("orderId")String orderId);

	List<GrantDetailVo> queryAllPaymentOrder(@Param("paymentStatus") String paymentStatus);

	void updateGrantDetailBatch(List<GrantDetailVo> list);

	void updateGrantDetailByPayment(GrantDetailVo grantDetail);

/*	@Select("<script>" +
			" SELECT o.`order_id`,d.`id`,o.`service_name`,o.`seller_name`" +
			" ,d.`payee_name`,d.`payee_account_bank_name`, d.`payee_account`,d.`pay_amount` ," +
			" o.`apply_time`,o.`order_type` FROM `seller_provide_order` o" +
			" INNER JOIN `provide_detail` d ON o.`order_id`=d.`order_id`" +
			" where 1=1" +
			" <when test='payeeName!=null'>" +
				" and d.`payee_name`=#{payeeName}" +
			"</when>"+
			" <when test='sellerName!=null'>" +
				" and o.`seller_name`=#{sellerName}" +
			"</when>"+
			" <when test='serviceName!=null'>" +
				" and o.`service_name`=#{serviceName}" +
			"</when>"+
			" <when test='startDate!=null'>" +
				" and o.`apply_time`>=#{startDate}" +
			"</when>"+
			" <when test='endDate!=null'>" +
				" and o.`apply_time`<=#{endDate}" +
			"</when>"+
			"</script>")
	@Results({
			@Result(property = "order_id", column = "orderId"),
			@Result(property = "service_name", column = "serviceName"),
			@Result(property = "seller_name", column = "sellerName"),
			@Result(property = "payee_name", column = "payeeName"),
			@Result(property = "payee_account_bank_name", column = "payeeAccountBankName"),
			@Result(property = "payee_account", column = "payeeAccount"),
			@Result(property = "pay_amount", column = "payAmount"),
			@Result(property = "apply_time", column = "applyTime"),
			@Result(property = "order_type", column = "orderType")
	})*/
	List<OrderDetailVO> queryByNames(@Param("startDate")String startDate, @Param("endDate")String endDate);
	
	List<PersonalTaxVo> queryByName(@Param("payeeName")String payeeName, @Param("serviceName") String serviceName,
			  @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("cardCode")String cardCode, @Param("startaxAmount")String startaxAmount, 
			  @Param("endtaxAmount")String endtaxAmount, @Param("startaxMoney")String startaxMoney, @Param("endtaxMoney")String endtaxMoney);
	
	List<PersonalTaxVo> findByQueryTime();

	OrderDetailVO findById(@Param("id")String id);
	
	List<OrderDetailVO> findByTime();

	void updatewangshangStatus(@Param("status")String status,@Param("outDetailId")String outDetailId,@Param("failReason") String failReason);

	void updateOrderIdStatus(@Param("batchNo")String batchNo);
	
	List<GrantDetailVo> findByOrderId(@Param("orderId")String orderId);
}
